# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2022-1-22 10:54
# @Author : huabao.tan
# @File : case_tas6.py
# @Software: PyCharm


import json
import requests
from TAS6.config import *
import time


def dealStr(str, type=None):
    size = len(str)
    a = 5 - size
    if type == None:
        str += "　" * a
    else:
        str += " " * a
    return str


response = requests.post(url=URL, headers=HEADERS, data=json.dumps(DATA)).json()
res = response['response']['pageData']['results']
for a in res:
    now_time = time.localtime(a['createTime'] / 1000)  # python 时间戳格式只支持10位数，超出就除以至10位数
    dt = time.strftime("%Y-%m-%d %H:%M:%S", now_time)
    print('userName: %s' % dealStr(str(a['userName'])), 'taskUserId: %s' % dealStr(str(a['taskUserId'])),
          'passCode: %s' % dealStr(str(a['passCode'])), 'taskId: %s' % dealStr(str(a['taskId'])),
          '时间：%s' % dealStr(str(dt)), 'userId:%s' % a['userId'])



